//package vip.finance.makemoney.service.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import jakarta.annotation.Resource;
//import org.springframework.stereotype.Service;
//import org.springframework.util.StringUtils;
//import vip.finance.makemoney.apiSpider.IApiSpider;
//import vip.finance.makemoney.apiSpider.SinaApi;
//import vip.finance.makemoney.apiSpider.result.StockDetailInfo;
//import vip.finance.makemoney.entity.EtfStockDetail;
//import vip.finance.makemoney.entity.UserStock;
//import vip.finance.makemoney.service.IEtfStockDetailService;
//import vip.finance.makemoney.service.IUserStockService;
//import vip.finance.makemoney.service.ETFFFStockService;
//
//import java.util.Arrays;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
///**
// * 股票信息
// *
// * @author yangbin
// * @since 2023-02-03
// */
//@Service
//public class ETFFFStockServiceImpl implements ETFFFStockService {
//
//    @Resource
//    private IUserStockService userStockService;
//    @Resource
//    private IEtfStockDetailService etfStockDetailService;
//    @Resource
//    private SinaApi sinaApi;
//    @Resource
//    private Map<String, IApiSpider> apiSpiderMap;
//
//    @Override
//    public Object list(Integer userId, String groupName) {
//        LambdaQueryWrapper<UserStock> queryWrapper = Wrappers.<UserStock>lambdaQuery().eq(UserStock::getUserId, userId);
//        if (StringUtils.hasLength(groupName)) {
//            queryWrapper.eq(UserStock::getGroupName, groupName);
//        }
//        List<UserStock> userStockList = userStockService.list(queryWrapper);
//        List<Integer> codeList = userStockList.stream().map(UserStock::getStockId).toList();
//
//
//        List<StockDetailInfo> realTimeList = apiSpiderMap.get("snowApiSpiderImpl").realTime(Arrays.asList("111"));
//        return realTimeList;
//    }
//
//    @Override
//    public Object etfDetail(String code) {
//        List<EtfStockDetail> stockDetailList = etfStockDetailService.list(Wrappers.<EtfStockDetail>lambdaQuery().eq(EtfStockDetail::getEtfCode, code));
//        List<String> codeList = stockDetailList.stream().map(EtfStockDetail::getStockCode).collect(Collectors.toList());
//        List<StockDetailInfo> stockDetailInfos = apiSpiderMap.get("snowApiSpiderImpl").realTime(codeList);
//
//        //var hq_str_fx_susdcnh="23:59:15,6.790500,6.795500,6.799800,259,6.802370,6.803400,6.777500,6.790500,离岸人民币（香港）,-0.140000,-0.009300,0.003807,City Credit Investment Bank. Labuan,6.307900,6.307900,-+--++-+,2023-02-07";
//        //                        时间                           昨收        今开     最高     最低                            涨幅百分比    涨幅金额   振幅
//        String response = sinaApi.daily("fx_scnhusd");
//
//        return stockDetailInfos;
//    }
//}
